<template>
  <div>
    <div @click="$router.push('/post/detail?id='+data.id)" class="box">
      <div class="left" v-if="data.images[0]">
        <img :src="data.images[0]" alt="">
      </div>
      <div class="right">
        <p>{{data.title}}</p>
        <span>{{time}} 阅读 {{data.watch||0}}</span>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props:['data'],
  computed: {
    time(){
     return  this.$moment(this.data.created_at).format('YYYY-MM-DD HH:mm')
    }
  },
}
</script>
<style lang="less" scoped>
.box{
  cursor: pointer;
  display: flex;
  padding: 15px 0;
  border-bottom: 1px solid #ddd;
  .left{
    margin-right:10px;
    img{
      width: 100px;
      height: 80px;
      object-fit: cover;
    }
  }
  .right{
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    span{
      color:#999;
      font-size: 14px;
    }
  }
}
</style>